﻿using BlazorApp3.Client.Application.Services;
using BlazorApp3.Shared;

namespace BlazorApp3.Client.Application.Features.Weatherforecast.Queries.GetList;

public record GetWeatherforecastListQuery : IRequest<WeatherForecast[]>;

internal class GetWeatherforecastListQueryHandler : IRequestHandler<GetWeatherforecastListQuery, WeatherForecast[]>
{
    private readonly IWeatherforecaseService _service;

    public GetWeatherforecastListQueryHandler(IWeatherforecaseService weatherforecaseService)
    {
        _service = weatherforecaseService;
    }

    public async Task<WeatherForecast[]> Handle(GetWeatherforecastListQuery request, CancellationToken cancellationToken)
    {
        return await _service.GetList();
    }
}